package com.hdyg.sixg.adapter;

import android.support.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hdyg.sixg.R;
import com.hdyg.sixg.entry.MiniShopBean;
import com.hdyg.sixg.util.ImageLoadUtil;
import java.util.List;

/**
 * @author CZB
 * @describe 购买矿机适配器
 * @time 2019/3/20 14:22
 */
public class BuyMiniAdapter extends BaseQuickAdapter<MiniShopBean.ListBean, BaseViewHolder> {
    public BuyMiniAdapter(int layoutResId, @Nullable List<MiniShopBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MiniShopBean.ListBean item) {
        helper.addOnClickListener(R.id.bt_buy);
        ImageLoadUtil.imageLoad(mContext, item.getPic(), helper.getView(R.id.iv_mini));
        String type = String.format(mContext.getResources().getString(R.string.buy_mini_type), item.getSize());
        String price = String.format(mContext.getResources().getString(R.string.buy_mini_price), item.getPrice());
        helper.setText(R.id.tv_type, type);
        helper.setText(R.id.tv_price, price);
    }
}
